package com.bysj.lms.pojo.entity;


import com.baomidou.mybatisplus.annotation.*;
import java.io.Serializable;
import java.time.LocalDateTime;
import com.bysj.lms.pojo.vo.PermissionVo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;


/**
 * <p>
 * 
 * </p>
 *
 * @author xiaojiakai
 * @since 2022-02-04
 */
@Getter
@Setter
@TableName("permission")
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class Permission implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    private Integer id;

    private Integer parentId;

    private String type;

    private String title;

    private String description;

    private String url;

    private String status;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.UPDATE)
    private LocalDateTime updateTime;

    public Permission(PermissionVo permissionVo){
        this.parentId = permissionVo.getParentId();
        this.title = permissionVo.getTitle();
        this.type = permissionVo.getType();
        this.description = permissionVo.getDescription();
        this.url = permissionVo.getUrl();
        this.status = "0";
    }

}
